package com.tanguy.driver.ui.driver.adapter

import android.view.View
import com.tanguy.driver.R
import com.tanguy.driver.base.JustAdapter
import com.tanguy.driver.bean.OrderBean
import com.tanguy.driver.utlis.TimeUtils
import com.tanguy.user.utlis.extend.setBackground
import com.tanguy.user.utlis.extend.setDrawable
import com.tanguy.user.utlis.extend.setText
import com.tanguy.driver.utlis.extend.toTimeString

/**
 * Created by dab on 2017/11/24 0024 15:04
 */
class OrderAdapter(data:ArrayList<OrderBean>):JustAdapter<OrderBean>(data, R.layout.item_order) {
    override fun bind(itemView: View, data: OrderBean, position: Int) {
        itemView.apply {
            setText(R.id.tv_type,data.typeString).setDrawable(left = data.typeImg)
            setText(R.id.tv_state,data.stateString)
            setText(R.id.tv_start,data.departure)
            setText(R.id.tv_end,data.bourn)
            setText(R.id.tv_time, data.bybustime.toTimeString(TimeUtils.TIME_YYYY_MM_DD_HH_MM_01))
            setBackground(R.id.view_background,data.backgroundImg)
        }
    }

    override fun onBindViewHolderLike(holder: NoDataHolder, position: Int) {
        super.onBindViewHolderLike(holder, position)
        holder.itemView.setText(R.id.tv_no_data,"近期暂无待服务订单",R.color.color_80ffffff)
    }
}